import 'package:flutter/material.dart';
import 'package:example/utils/common.dart';
import 'package:get/get.dart';

/// 自定义组件基类
abstract class CustomDialog<T extends GetxController> extends Dialog {
  final T initController;

  CustomDialog(T defaultController, {Key? key, T? externalController})
      : initController = externalController ?? defaultController,
        super(key: key){
    hideKeyboardFocus();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<T>(
      init: initController,
      global: false,
      builder: (controller) {
        return initView(context, controller);
      },
    );
  }

  Widget initView(BuildContext context, T controller);
}
